package org.imis.action;

import java.util.List;
import java.util.Map;

import org.hibernate.HibernateException;
import org.imis.domain.News;
import org.imis.service.NewsManage;

import com.opensymphony.xwork2.ActionContext;

public class FindOneAction {
	private NewsManage newsManage;
    private String table;
    private Map request; 
    private String id;
    
	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}
	public String getTable() {
		return table;
	}
	public void setTable(String table) {
		this.table = table;
	}
	public NewsManage getNewsManage() {
		return newsManage;
	}
	public void setNewsManage(NewsManage newsManage) {
		this.newsManage = newsManage;
	}
	public String execute() throws NumberFormatException, HibernateException, ClassNotFoundException
	{
		request = (Map)ActionContext.getContext().get("request");  
		Object news = newsManage.findOneList(table,Integer.parseInt(id));
		request.put("news", news);
		if(table.equals("Teach"))
		{
		return "tsuccess";
		}
		return "success";
		
	}
}
